# Maintainer: Ryuta Suzuki <oroppas@gmail.com>

_realname=et-xmlfile
pkgbase=mingw-w64-python-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-python3-${_realname}" "${MINGW_PACKAGE_PREFIX}-python2-${_realname}")
pkgver=1.0.1
pkgrel=4
pkgdesc="A low memory library for creating large XML files (mingw-w64)"
url="https://et-xmlfile.readthedocs.io/"
arch=('any')
license=('MIT')
makedepends=("${MINGW_PACKAGE_PREFIX}-python3-setuptools"
             "${MINGW_PACKAGE_PREFIX}-python2-setuptools"
             "${MINGW_PACKAGE_PREFIX}-python3-lxml"
             "${MINGW_PACKAGE_PREFIX}-python2-lxml")
source=("https://pypi.python.org/packages/source/e/et_xmlfile/et_xmlfile-${pkgver}.tar.gz"
        "LICENSE")
sha256sums=('614d9722d572f6246302c4491846d2c393c199cfa4edc9af593437691683335b'
            '69a810ce7342b9198bd2e44d0098e30b4ce31078019e6cf990a5cd6ce2c3f7ce')

prepare() {
  cp -a et_xmlfile-${pkgver}{,-py2}
}

build() {
  cd ${srcdir}/et_xmlfile-${pkgver}
  python3 setup.py build

  cd ${srcdir}/et_xmlfile-${pkgver}-py2
  python2 setup.py build
}

package_python3-et-xmlfile() {
  depends=(
    "${MINGW_PACKAGE_PREFIX}-python3-lxml"
  )

  cd ${srcdir}/et_xmlfile-${pkgver}
  MSYS2_ARG_CONV_EXCL="--prefix=;--install-scripts=;--install-platlib=" \
  ${MINGW_PREFIX}/bin/python3 setup.py install --root=${pkgdir} --prefix=${MINGW_PREFIX} --optimize=1
  install -Dm644 ${srcdir}/LICENSE ${pkgdir}${MINGW_PREFIX}/share/licenses/python3-${_realname}/LICENSE
}

package_python2-et-xmlfile() {
  depends=(
    "${MINGW_PACKAGE_PREFIX}-python2-lxml"
  )

  cd ${srcdir}/et_xmlfile-${pkgver}-py2
  MSYS2_ARG_CONV_EXCL="--prefix=;--install-scripts=;--install-platlib=" \
  ${MINGW_PREFIX}/bin/python2 setup.py install --root=${pkgdir} --prefix=${MINGW_PREFIX} --optimize=1
  install -Dm644 ${srcdir}/LICENSE ${pkgdir}${MINGW_PREFIX}/share/licenses/python2-${_realname}/LICENSE
}

package_mingw-w64-i686-python2-et-xmlfile() {
  package_python2-et-xmlfile
}

package_mingw-w64-i686-python3-et-xmlfile() {
  package_python3-et-xmlfile
}

package_mingw-w64-x86_64-python2-et-xmlfile() {
  package_python2-et-xmlfile
}

package_mingw-w64-x86_64-python3-et-xmlfile() {
  package_python3-et-xmlfile
}

# vim:set ts=2 sw=2 et:
